<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateParentOrdersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('parent_orders', function (Blueprint $table) {
            $table->increments('parent_order_id')->comment("订单ID,自增");
            $table->integer('user_id')->unsigned()->comment("用户ID");
//            $table->string('order_ids')->comment("子订单集合,逗号分割,1,2,3");
            $table->integer('trading_stream_id')->unsigned()->comment("交易流水ID");
            $table->string('all_price')->comment("总价");
            $table->tinyInteger('state')->comment("状态");
            $table->integer('user_address_id')->unsigned()->comment("地址ID");
            $table->timestamps();
            $table->engine = 'InnoDB';
            $table->index('parent_order_id');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('parent_orders');
    }
}
